load("@io_bazel_rules_scala//scala:scala.bzl", "scala_binary", "scala_library")

scala_library(
    name = "util",
    srcs = ["RouteGuideUtil.scala"],
    resources = ["//example/routeguide:feature_db"],
    deps = [
        "//example/routeguide:routeguide_grpc_scala_library",
        "@maven_scala//:com_thesamet_scalapb_lenses_2_12",
        "@maven_scala//:com_thesamet_scalapb_scalapb_json4s_2_12_0_12_0",
        "@maven_scala//:com_thesamet_scalapb_scalapb_runtime_2_12",
    ],
)

scala_binary(
    name = "client",
    srcs = ["RouteGuideClient.scala"],
    main_class = "example.routeguide.scala.RouteGuideClient",
    deps = [
        ":util",
        "//example/routeguide:routeguide_grpc_scala_library",
        "@maven_scala//:com_thesamet_scalapb_lenses_2_12",
        "@maven_scala//:com_thesamet_scalapb_scalapb_runtime_2_12",
        "@maven_scala//:com_thesamet_scalapb_scalapb_runtime_grpc_2_12",
        "@maven_scala//:io_grpc_grpc_api",
        "@maven_scala//:io_grpc_grpc_stub",
    ],
)

scala_binary(
    name = "server",
    srcs = [
        "AtomicRef.scala",
        "RouteGuideServer.scala",
        "RouteGuideService.scala",
    ],
    main_class = "example.routeguide.scala.RouteGuideServer",
    deps = [
        ":util",
        "//example/routeguide:routeguide_grpc_scala_library",
        "@maven_scala//:com_thesamet_scalapb_lenses_2_12",
        "@maven_scala//:com_thesamet_scalapb_scalapb_runtime_2_12",
        "@maven_scala//:com_thesamet_scalapb_scalapb_runtime_grpc_2_12",
        "@maven_scala//:io_grpc_grpc_api",
        "@maven_scala//:io_grpc_grpc_stub",
    ],
)
